package com.fdd.op.sdk.request.api.unwantedauthsign;

import com.fdd.op.sdk.ApiRuleException;
import com.fdd.op.sdk.BaseFddRequest;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.RequestField;
import com.fdd.op.sdk.internal.util.FddHashMap;
import com.fdd.op.sdk.response.api.unwantedauthsign.UnwantedAuthSignResponse;

import java.util.Map;

public class UnwantedAuthSignBaseRequest extends BaseFddRequest<UnwantedAuthSignResponse> {

    @Override
    public String getApiMethodName() {
        return "/base/api/unwantedAuthSign";
    }

    @Override
    public Map<String, Object> getTextParams() {
        FddHashMap txtParams = new FddHashMap();
        if(this.udfParams != null) {
            txtParams.putAll(this.udfParams);
        }
        return txtParams;
    }

    @Override
    public Class<UnwantedAuthSignResponse> getResponseClass() {
        return UnwantedAuthSignResponse.class;
    }

    @Override
    public void check() throws ApiRuleException {
        if(getAuthorizerFlag() != 1 && getAuthorizerFlag() != 2){
            throw new ApiRuleException(null, "authorizerFlag只能取1或者2");
        }
    }

    @Override
    public String getHttpMethod() {
        return Constants.METHOD_POST;
    }

    @RequestField(value = "授权主体类型：1个人, 2企业")
    private int authorizerFlag;

    @RequestField(value = "授权主体在当前系统的唯一标识，个人主体传accountId，企业主体传companyId")
    private String authorizerTargetId;

    @RequestField(value = "授权主体在第三方业务系统的唯一标识，个人主体传tpAccountId，企业主体传tpOrgId")
    private String tpAuthorizerTargetId;

    @RequestField(value = "appId")
    private String appId;

    @RequestField(value = "主体subjectId")
    private String subjectId;

    public int getAuthorizerFlag() {
        return authorizerFlag;
    }

    public void setAuthorizerFlag(int authorizerFlag) {
        this.authorizerFlag = authorizerFlag;
    }

    public String getAuthorizerTargetId() {
        return authorizerTargetId;
    }

    public void setAuthorizerTargetId(String authorizerTargetId) {
        this.authorizerTargetId = authorizerTargetId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTpAuthorizerTargetId() {
        return tpAuthorizerTargetId;
    }

    public void setTpAuthorizerTargetId(String tpAuthorizerTargetId) {
        this.tpAuthorizerTargetId = tpAuthorizerTargetId;
    }

    public String getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(String subjectId) {
        this.subjectId = subjectId;
    }
}
